# Maintainer:
# Contributor: Alad Wenter <alad@mailbox.org>
# Contributor: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: neuromante <lorenzo.nizzi.grifi@gmail.com>
# Contributor: marc0s <marc0s@fsfe.org>

pkgname=pcsc-perl
pkgver=1.4.14
pkgrel=14
pkgdesc="A Perl Module for PC/SC SmartCard access"
arch=(loong64 x86_64)
url="https://pcsc-perl.apdu.fr/"
license=(GPL-2.0-or-later)
depends=(
  glibc
  pcsclite
  perl
)
makedepends=(pkgconfig)
options=(!emptydirs)
source=($url/$pkgname-$pkgver.tar.bz2{,.asc})
sha256sums=('2722b7e5543e4faf3ba1ec6b29a7dfec6d92be1edec09d0a3191992d4d88c69d'
            'SKIP')
# Ludovic Rousseau <ludovic.rousseau@free.fr>
validpgpkeys=('F5E11B9FFE911146F41D953D78A1B4DFE8F9C57E')

build() {
  cd $pkgname-$pkgver

  # install module in vendor directories.
  PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
}

package() {
  make DESTDIR="$pkgdir" install -C $pkgname-$pkgver
  # set the library to be root-writable so it can be stripped
  chmod 755 "$pkgdir"/usr/lib/perl*/*/vendor_perl/auto/Chipcard/PCSC/PCSC.so
}
